package com.zcf.mapper;

import com.zcf.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * @author zcf
 */
@Mapper
public interface UserMapper {

    @Select("SELECT * FROM user where username=#{username}")
    User ByUserName(String username);

    @Insert("INSERT INTO user(username,password,create_time,update_time) values (#{username},#{password},now(),now())")
    void register(String username, String password);


    @Update("update user set nickname=#{nickname},email=#{email},update_time=now() where id=#{id}")
    void update(User user);

    @Update("update  user set password=#{password},update_time=now() where id=#{id}")
    void updatePwd(User user2);

    @Update("update user set user_pic=#{avatarUrl} where id=#{id} ")
    void url(String avatarUrl,Integer id);
}
